<?php

/*
 * 测试适配器模式
 */

namespace App\Controller;

use App\DesignPattern\Adapter\UserStrategyFactory;


class ControllerAdapter
{
	
	public function actionMysql(){
	    $db = UserStrategyFactory::create();
	    var_dump($db);
	    $rows = $db->query("SELECT * FROM `user`");
	    var_dump($rows);
	}

    public function actionMysqli(){
        $db = UserStrategyFactory::create('mysqli');
        var_dump($db);
        $rows = $db->query("SELECT * FROM `user`");
        var_dump($rows);
    }

    public function actionPdo(){
        $db = UserStrategyFactory::create('pdo');
        var_dump($db);
        $rows = $db->query("SELECT * FROM `user`");
        var_dump($rows);
    }
}
